#include "hplcqinfinecollectorparsepacket.h"
#include "hplcqinfinecollectorprotocoldata.h"
#include "common/hplcqinfinepfcid.h"
#include "common/hplcqinfinepacketformat.h"

namespace hplc
{
namespace qinfine
{

HplcQinfineCollectorParsePacket::HplcQinfineCollectorParsePacket(HplcQinfineCollectorProtocolData &data, CollectorParam &param, QObject *parent)
    : HplcQinfineParseCommonPacket (data, param, parent)
{

}

HplcQinfineCollectorParsePacket::~HplcQinfineCollectorParsePacket()
{

}

void HplcQinfineCollectorParsePacket::parseSet(quint8 pfc, char *data)
{
#if 1
    switch (pfc)
    {
    case PFC_COLLECTOR_CHANNEL:
        emit setChannel(data[0]);
        break;
    case PFC_COLLECTOR_BOTTLE_NUMBER:
    {
        quint16 number = PTR2U16(data);
        emit setBottleNumber(number);
    }
        break;
    case PFC_COLLECTOR_START_STOP:
        emit setStartStop(data[0]);
        break;
    case PFC_COLLECTOR_NUMBER_PATTERN:
        emit setNumberPattern(data[0]);
        break;
    case PFC_COLLECTOR_PREV_START:
        emit setPrevStart();
        break;
    case PFC_COLLECTOR_NEXT_START:
        emit setNextStart();
        break;
    case PFC_COLLECTOR_EXT_SYSTEM:
    {
        HplcQinfineCollectorProtocolData *m_d = static_cast<HplcQinfineCollectorProtocolData*>(this->m_d);
        m_d->m_systemParser->parseSet(data[0], data + 1);
    }
        break;
    case PFC_COLLECTOR_EXT_USER:
        break;
    default:
        HplcQinfineParseCommonPacket::parseSet(pfc, data);
        break;
    }
#endif
}

void HplcQinfineCollectorParsePacket::parseGet(quint8 pfc, char *data)
{
    switch (pfc)
    {
    case PFC_COLLECTOR_CHANNEL:
        break;
    case PFC_COLLECTOR_BOTTLE_NUMBER:
        break;
    case PFC_COLLECTOR_START_STOP:
        break;
    case PFC_COLLECTOR_NUMBER_PATTERN:
        break;
    case PFC_COLLECTOR_PREV_START:
        break;
    case PFC_COLLECTOR_NEXT_START:
        break;
    case PFC_COLLECTOR_EXT_SYSTEM:
    {
        HplcQinfineCollectorProtocolData *m_d = static_cast<HplcQinfineCollectorProtocolData*>(this->m_d);
        m_d->m_systemParser->parseGet(data[0], data + 1);
    }
        break;
    case PFC_COLLECTOR_EXT_USER:
        break;
    default:
        HplcQinfineParseCommonPacket::parseGet(pfc, data);
        break;
    }
}

} // qinfine
} // hplc
